import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayReceiveVO, PayReceiveForm, PayReceiveQuery } from '@/api/system/PayReceive/types';

/**
 * 查询收款方式列表
 * @param query
 * @returns {*}
 */

export const listPayReceive = (query?: PayReceiveQuery): AxiosPromise<PayReceiveVO[]> => {
  return request({
    url: '/system/PayReceive/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询收款方式详细
 * @param id
 */
export const getPayReceive = (id: string | number): AxiosPromise<PayReceiveVO> => {
  return request({
    url: '/system/PayReceive/' + id,
    method: 'get'
  });
};

/**
 * 新增收款方式
 * @param data
 */
export const addPayReceive = (data: PayReceiveForm) => {
  return request({
    url: '/system/PayReceive',
    method: 'post',
    data: data
  });
};

/**
 * 修改收款方式
 * @param data
 */
export const updatePayReceive = (data: PayReceiveForm) => {
  return request({
    url: '/system/PayReceive',
    method: 'put',
    data: data
  });
};

/**
 * 删除收款方式
 * @param id
 */
export const delPayReceive = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/PayReceive/' + id,
    method: 'delete'
  });
};
